/*
 * Generated via the com.flca generator
 */
package com.logica.hackthon.dao.impl;
import com.flca.frw.dao.DaoException;
import com.flca.frw.dao.DaoHelperHibernate;
import com.flca.frw.log.Log;
import com.logica.hackthon.dao.intf.GamePlayerDaoIntf;
import com.logica.hackthon.entity.GamePlayer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
 * @todo add comment for javadoc
 *
 * @author robin
 * @version $Id: EntityDaoImpl.javajet,v 1.1 rbakkerus Exp $
 * @generated
 */
public class GamePlayerDaoImplJpa implements GamePlayerDaoIntf {
	public GamePlayer save(GamePlayer aSource) throws DaoException
	{
		logStart("save()");
		Long pk = (Long) DaoHelperHibernate.save(aSource);
		logFinish("save()");
		return retrieve(pk);
	}
	public List<GamePlayer> findAll() throws DaoException 
	{
		logStart("findAll()");
		List<GamePlayer> result = new ArrayList<GamePlayer>();
		Iterator<Object> iterator = DaoHelperHibernate.findAll(GamePlayer.class);
		while (iterator.hasNext()) {
			GamePlayer item = (GamePlayer) iterator.next();
			result.add(item);
		}
		logFinish("findAll()");
		return result;
	}
	public GamePlayer retrieve(Long aPk) throws DaoException 
	{
		logStart("retrieve()");
		Object object = DaoHelperHibernate.retrieveById(GamePlayer.class, aPk);
		logFinish("retrieve()");
		return (GamePlayer) object;
	}
	public void remove(Long aPk) throws DaoException 
	{
		logStart("remove()");
		DaoHelperHibernate.removeById(GamePlayer.class, aPk);
		logFinish("remove()");
	}
	private void logStart(String aMsg) {
		Log.debug("start GamePlayerDaoImplJpa" + aMsg);	
	}
	private void logFinish(String aMsg) {
		Log.debug("finish GamePlayerDaoImplJpa" + aMsg);	
	}
}
